#include <stdio.h>
// 二维数组实现,输入分别输入两组商品的价格,商品的价格:23.4元,25.8元,98.5元,12.3元,45.9元,39.2元,
// 分别计算每组商品的总价,所有商品的总价,每组商品的平均价格,所有商品的平均价格
int main()
{
  double arr[2][3] = {{23.4, 25.8, 98.5}, {12.3, 45.9, 39.2}}, sum = 0, sum1 = 0, sum2 = 0;
  int all_length = sizeof(arr);
  int singel_length = sizeof(arr[0][0]);
  int length = all_length / singel_length;
  int cols = sizeof(arr[0]) / singel_length;
  int rows = length / cols;
  for (int i = 0; i < rows; i++)
  {
    for (int j = 0; j < cols; j++)
    {
      if (i == 0)
        sum1 += arr[i][j];
      else
        sum2 += arr[i][j];
      sum += arr[i][j];
    }
  }
  printf("第一组商品总价为:%.2lf\n", sum1);
  printf("第二组商品总价为:%.2lf\n", sum2);
  printf("俩组商品总价为:%.2lf\n", sum);
  printf("第一组商品均价为:%.2lf\n", sum1/cols);
  printf("第二组商品均价为:%.2lf\n", sum2/cols);
  printf("所有商品均价为:%.2lf\n", sum/length);
  return 0;
}